#ifndef CONTROLLEDVERTIBRATEOBJECT_H_
#define CONTROLLEDVERTIBRATEOBJECT_H_

#include "TextureManager.h"
#include "SpriteList.h"
#include "VertibrateObject.h"

#define DUST_FILE "Images/dust.bmp"

class ControlledVertibrateObject : public VertibrateObject
{
	//Vector2D sideNormals[4];
	protected:
	float forceDamageDenominator;
	float lastRotation;
	virtual bool GetFreeRotate();

	float health;
	float maxHealth;
	float movingTimeModifier;
	int textureIndex;
	int poseIndex;
	SpriteList * spriteList;
	TextureManager * textureManager;
	bool movingLeft;
	bool movingRight;
	bool isOnHead;
	bool facingRight;
	int rotateCount;
	int isNotOnGroundCount;
	int isOnGroundCount;
	int isOnLeftWallCount;
	int isOnRightWallCount;
	
	virtual float GetAnimationSpeed();
	public:
	
	virtual Vector2D VelocityAtPoint(Vector2D point);
	ControlledVertibrateObject( TextureManager * textureManager,
					 			Vector2D position,
					  			Vector2D * vertices,
					  			int numVertices,
					  			float mass,
				      			bool isGrabbable,
				      			char * skeletonFile);
	virtual ~ControlledVertibrateObject();
	virtual void AddGravity();
	virtual bool VertibrateObjectPreDrawEntryPoint();
	virtual void AddForceObjectSpace(Vector2D ray, Vector2D origin);
	virtual void AddForceObjectSpace(Vector2D ray, Vector2D origin, bool groundForce);
	
	virtual void Rotate(float theta);
	
	virtual void ThinkEntryPoint(double elapsedTime);
	virtual bool VertibrateObjectPreThinkEntryPoint(double elapsedTime);
	
	virtual void ControlledVertibrateObjectThinkEntryPoint(double elapsedTime);
	virtual void ControlledObjectThinkEntryPoint(double elapsedTime);
	virtual void ControlledObjectDrawEntryPoint();
	virtual void ControlledObjectRotateEntryPoint(float cosTheta, float sinTheta);
	virtual void ControlledObjectAddGravityEntryPoint();
	
	virtual void AddDamage(float damage);
	float GetHealth();
	void SetHealth(float health);
	virtual void MoveRight();
	virtual void MoveLeft();
	virtual void Jump();
};
#endif /*CONTROLLEDVERTIBRATEOBJECT_H_*/
